package visiopuce.graph;

import java.awt.Color;
import java.io.Serializable;

import org.jfree.util.ObjectUtilities;
import org.jfree.util.PublicCloneable;

/**
 * A simple representation of a FloatingBar. The FloatingBar has a description
 * and a duration.
 */
public class FloatingBar implements Cloneable, PublicCloneable, Serializable {

	/** For serialization. */
	private static final long serialVersionUID = 1094303785346988894L;

	/** The FloatingBar description. */
	private String description;

	private Long start;

	private Long end;

	/** The percent complete (<code>null</code> is permitted). */
	private Double percentComplete;

	private String toolTip;

	private String link;

	private Color color;

	private Color colorContour;
	
	private Color colorTexte;

	public Color getColorTexte() {
		return colorTexte;
	}

	public void setColorTexte(Color colorTexte) {
		this.colorTexte = colorTexte;
	}

	private String titreLigne = "";


	public Long getStart() {
		return start;
	}

	public Long getEnd() {
		return end;
	}

	/**
	 * Creates a new FloatingBar.
	 * 
	 * @param description
	 *            the FloatingBar description (<code>null</code> not permitted).
	 * @param start
	 *            the start .
	 * @param end
	 *            the end .
	 */
	public FloatingBar(String description, Long start, Long end, Color color, String tooltip, String link, Color colorContour, Color colorTexte) {
		this.description = description;
		this.toolTip = tooltip;
		this.link = link;
		this.start = start;
		this.end = end;
		this.color = color;
		this.colorContour = colorContour;
		this.colorTexte = colorTexte;
	}

	public Color getColorContour() {
		return colorContour;
	}

	public void setColorContour(Color colorContour) {
		this.colorContour = colorContour;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	/**
	 * Returns the FloatingBar description.
	 * 
	 * @return The FloatingBar description (never <code>null</code>).
	 */
	public String getDescription() {
		return this.description;
	}

	/**
	 * Sets the FloatingBar description.
	 * 
	 * @param description
	 *            the description (<code>null</code> not permitted).
	 */
	public void setDescription(String description) {
		if (description == null) {
			throw new IllegalArgumentException("Null 'description' argument.");
		}
		this.description = description;
	}
	
	/**
	 * Returns the FloatingBar toolTip.
	 * 
	 * @return The FloatingBar toolTip (never <code>null</code>).
	 */
	public String getToolTip() {
		return this.toolTip;
	}

	/**
	 * Sets the FloatingBar toolTip.
	 * 
	 * @param toolTip
	 *            the toolTip (<code>null</code> not permitted).
	 */
	public void setToolTip(String toolTip) {
		this.toolTip = toolTip;
	}


	/**
	 * Returns the percentage complete for this FloatingBar.
	 * 
	 * @return The percentage complete (possibly <code>null</code>).
	 */
	public Double getPercentComplete() {
		return this.percentComplete;
	}

	/**
	 * Sets the percentage complete for the FloatingBar.
	 * 
	 * @param percent
	 *            the percentage (<code>null</code> permitted).
	 */
	public void setPercentComplete(Double percent) {
		this.percentComplete = percent;
	}

	/**
	 * Sets the percentage complete for the FloatingBar.
	 * 
	 * @param percent
	 *            the percentage.
	 */
	public void setPercentComplete(double percent) {
		setPercentComplete(new Double(percent));
	}

	/**
	 * Tests this object for equality with an arbitrary object.
	 * 
	 * @param object
	 *            the other object (<code>null</code> permitted).
	 * 
	 * @return A boolean.
	 */
	public boolean equals(Object object) {
		if (object == this) {
			return true;
		}
		if (!(object instanceof FloatingBar)) {
			return false;
		}
		FloatingBar that = (FloatingBar) object;
		if (!ObjectUtilities.equal(this.description, that.description)) {
			return false;
		}
		if (!ObjectUtilities.equal(this.start, that.start)) {
			return false;
		}
		if (!ObjectUtilities.equal(this.end, that.end)) {
			return false;
		}
		if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) {
			return false;
		}
		return true;
	}

	/**
	 * Returns a clone of the task.
	 * 
	 * @return A clone.
	 * 
	 * @throws CloneNotSupportedException
	 *             never thrown by this class, but subclasses may not support
	 *             cloning.
	 */
	public Object clone() throws CloneNotSupportedException {
		FloatingBar clone = (FloatingBar) super.clone();
		return clone;
	}

	public String getTitreLigne() {
		return this.titreLigne ;
	}

	public void setTitreLigne(String titreLigne) {
		this.titreLigne = titreLigne;
	}


}
